from django.contrib import admin

# Register your models here.

from .models import *

class ScriptsAdmin(admin.ModelAdmin):
    list_display = ('zwname','qpname')
    list_per_page = 30
    search_fields = ('zwname','qpname')

admin.site.register(Scripts,ScriptsAdmin)

class HostAdmin(admin.ModelAdmin):
    list_display = ('hostname','assetgroup','network_ip','cpu','memory','disk',)
    list_per_page = 30
    # filter_horizontal = ('type','user','servicegroup',)
    search_fields = ('hostname', 'network_ip', 'assetgroup')

admin.site.register(AssetInfo,HostAdmin)


class HostTypeAdmin(admin.ModelAdmin):
    list_display = ('name','type',)

admin.site.register(HostType,HostTypeAdmin)


class ServicesAdmin(admin.ModelAdmin):
    list_display = ('zwname','qpname','shellscripts','status_cmd')
    list_per_page = 30
    filter_horizontal = ('group',)
    search_fields = ('zwname', 'qpname','shellscripts')

admin.site.register(Services,ServicesAdmin)

class FunctionAdmin(admin.ModelAdmin):
    # filter_horizontal = ('groupname',)
    list_editable = ('groupname' ,'shellscripts','dependonservice')
    list_display = ('zwname', 'groupname' ,'shellscripts', 'argvs','dependonservice')

admin.site.register(Functions,FunctionAdmin)

admin.site.register([AssetLoginUser,assetgroup,initenv,CityInfos,ServiceGroup,FunctionGroup])